package com.sudo.dao.admin.model.bo;

import com.sudo.common.utils.PatternUtil;
import com.sudo.common.validenum.EnumValue;
import com.sudo.common.validenum.NotBlankThenPattern;
import lombok.Data;

import javax.validation.constraints.NotBlank;

@Data
public class SysMethodJobSaveBO {

    @NotBlank(message = "模块名不能为空")
    private String beanName;

    @NotBlank(message = "方法名不能为空")
    private String methodName;

    private String methodParams;
    // Cron表达式
    @NotBlank(message = "cron表达式不能为空")
    private String cronExpression;

    @NotBlank(message = "日志状态不能为空")
    @EnumValue(strValues = {"ON","OFF"},message = "日志状态必须为指定值ON/OFF")
    private String logStatus;

    @NotBlank(message = "邮件状态不能为空")
    @EnumValue(strValues = {"ON","OFF"},message = "邮件状态必须为指定值ON/OFF")
    private String mailStatus;

    private String mailAddress;

    private String note;

    @NotBlankThenPattern(regexp = PatternUtil.commaSplitNumber,message = "子任务ID格式不正确")
    private String nextJobIds;

    @NotBlank(message = "子任务运行模式不能为空")
    @EnumValue(strValues = {"SYNC", "ASYNC"}, message = "子任务运行模式不匹配，必须为SYNC/ASYNC")
    private String nextJobMode;

    @NotBlank(message = "子任务限制不能为空")
    @EnumValue(strValues = {"EX_STOP", "EX_GOON"}, message = "子任务限制不匹配，必须为EX_STOP/EX_GOON")
    private String nextJobLimit;

}
